#include "filex.h"

ssize_t GetFileSize( char *filename , int fd )
{
	struct stat	filestat ;
	
	int		nret = 0 ;
	
	if( filename )
	{
		nret = stat( filename , & filestat ) ;
		if( nret )
			return -1;
	}
	else if( fd >= 0 )
	{
		nret = fstat( fd , & filestat ) ;
		if( nret )
			return -2;
	}
	else
	{
		return -3;
	}
	
	return (ssize_t)(filestat.st_size);
}

